﻿using Commonality.ServerEnum;
using Commonality.ServerEnum.AttributeEnum;
using Commonality.ValidateModel;
using System.ComponentModel.DataAnnotations;

namespace ModelToDto.Managemen
{
    public class UsersDTO
    {
        [Display(Name = "主键")]
        public int UserId { get; set; }
        [Display(Name = "用户名称")]
        public string? Name { set; get; }
        [Display(Name = "密码")]
        public string? Password { set; get; }

        /// <summary>
        /// 用户状态  0正常 1冻结 2删除
        /// </summary>
        [Display(Name = "用户状态")]

        public int Status { set; get; }
        [Display(Name = "手机号")]
        public string? Phone { set; get; }
        [Display(Name = "手机号")]
        public string? Mobile { set; get; }
        [Display(Name = "地址")]
        public string? Address { set; get; }
        [Display(Name = "邮箱")]
        public string? Email { set; get; }

        public long QQ { set; get; }

        public string? WeChat { set; get; }
        [Display(Name = "性别")]
        public int Sex { set; get; }
        [Display(Name = "登录时间")]
        public DateTime LastLoginTime { set; get; } = DateTime.Now;
        [Display(Name = "用户类型")]
        public int? UserType { get; set; }

        public string? UserTypeRemark
        {
            get
            {
                if (UserType != null)
                {
                    return ReadEnumRemark.GetEnumRemark<UserTypeEnum>((int)UserType);
                }
                else
                {
                    return "枚举错误";
                }

            }
        }
        public string SexRemark
        {
            get
            {
                return ReadEnumRemark.GetEnumRemark<GenderEnum>(Sex);
            }
        }

        public string StatusRemark
        {
            get
            {
                return ReadEnumRemark.GetEnumRemark<UserStatuEnum>(Status);
            }
        }
    }
}